#pragma once
#include "RenderObject.h"

class TextureDrawObject :
	public RenderObject
{
public:
	enum VertexPosition{ bottomLeft = 0, bottomRight, topRight, topLeft };
	struct VertexData
	{
		glm::vec2 pos;
		glm::vec2 uv;
		glm::vec4 color;
		VertexData() : color(glm::vec4(1.0f))
		{
		}
	};

	TextureDrawObject();
	TextureDrawObject(Camera *camera, Texture *tex, Shader *shader);
	virtual ~TextureDrawObject();

	void Init(Camera *camera, Texture *tex, Shader *shader);
	//void SetVertex(glm::vec3 &topLeft, glm::vec3 &topRight, glm::vec3 &bottomLeft, glm::vec3 &bottomRight);
	void SetTexcoord(glm::vec2 uvs[4]);
	//void SetScale(glm::vec3 &scale);
	void SetSize(float w, float h);
	void SetAnchorPoint(glm::vec2 &pt);
	void SetVertexColor(VertexPosition pos, glm::vec4 &color);
	virtual void Draw() override;

protected:
	void MakeVertexs();
	static VaoMesh *GetTextureMesh();

	VertexData m_vertexDatas[4];
	glm::vec2 m_anchorPoint;
	float m_width;
	float m_height;
	//glm::vec3 m_scale;
};

